		var count=1;
		$(function()
		{
			$("#show").click(function()
			{
				$("#hide").fadeIn(1000);
				$("#showContext").slideDown(2000,function()
				{
					$("#show").fadeOut(2000);
				});
			});
			
			$("#button").click(function()
			{	
				var br = $("<br/>");
				var input = $("<a>文件"+(++count)+"：<a/><input type='file' class='len' name='upload' id='file1"+(count)+"' style='height:20px;'/>");
				var button = $("<input type='button' style='height:20px; width:50px;' value='删除"+(count)+"' />");
				$("#more").append(br).append(input).append(button).append(br);
				var length = $(".len").size();
				if(length==4){
					$("#button").attr("disabled","disabled");
				}
				button.click(function()
				{	
					br.remove();
					input.remove();
					button.remove();
					$("#button").attr("disabled","");
				});
	 		});
	 		$("#hide").click(function()
	 		{
	 			$("#showContext").fadeOut(2000);
	 			$("#hide").fadeOut(2000,function()
	 			{
	 				$("#show").fadeIn(2000);
	 			});
	 			
	 		});
	 		
		});

function refreshProgress()
{
    UploadMonitor.getUploadInfo(updateProgress);
}

function updateProgress(uploadInfo){
    if (uploadInfo.inProgress){
        $('input').attr("disabled","disabled");
		if(uploadInfo.totalSize != 0){
			var progressPercent = Math.ceil((uploadInfo.bytesRead / uploadInfo.totalSize) * 100);
	        var secondsElapsed = Math.ceil(uploadInfo.deltaTime/1000);
	        var speed = Math.ceil(uploadInfo.bytesRead / (uploadInfo.deltaTime/1000 * 1024));
	        var progressBarBoxContentWidth =parseInt(progressPercent * 3.5) + 'px';
	        $('#uploadedFiles').html(uploadInfo.uploadedFiles);
	        $('#progressBarText').html('耗时: <b>' + secondsElapsed + '</b> 秒; 上传速度: <b>' + speed + 'KB/s</b><br/>上传中 <b>' + uploadInfo.curFileName + '... [' + progressPercent + '%]</b> ');
	        $('#progressBarBoxContent').css("width", progressBarBoxContentWidth);
		}
        window.setTimeout('refreshProgress()', 500);
    }else{
    	$('#progressBar').css("display","none");
    	$('#progressBarBoxContent').css("width","3px");
        $('input').attr("disabled","");
        if(uploadInfo.errorMsg){
        	$('#uploadedFiles').html('<br/><font color="red"><b>' + uploadInfo.errorMsg + '</b></font><br/>');
        }else{
        	$('#uploadedFiles').html(uploadInfo.uploadedFiles + '<br/><b>文件总大小: ' + Math.ceil(uploadInfo.totalSize/1024) + 'KB</b>');
    	}
    }

    return true;
}

function startProgress()
{	
	if($("#file1").val()==null||$("#file1").val()=="")
	{
		art.dialog({
			title: '温馨提示',
			lock: true,
		    content: '请选择要上传的文件！！',
		    yesFn: function(){}
		});
		return false;
	}
	var fileIndex = 0;
	//$('uploadedFiles').innerHTML ="";
    $('#progressBar').css("display","block");
    $('#progressBarText').append("<b>上传中...</b>");
    $('#uploadbutton').attr("disabled","disabled");
    $('#uploadedFiles').append("");

    // wait a little while to make sure the upload has started ..
    window.setTimeout("refreshProgress()", 200);
    return true;
}
